/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package orkomet;

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import javax.jws.WebService;

/**
 *
 * @author Administrator
 */
@WebService
public class Frontend {
    public String executeQuery(String sparqlString){
        Query query = QueryFactory.create(sparqlString) ;
        QueryExecution qexec = QueryExecutionFactory.create(query, RDFEngine.GetModel()) ;
        try {
            ResultSet results = qexec.execSelect() ;
            return ResultSetFormatter.asXMLString(results);
        } finally {
            qexec.close();
        }
    }
}
